{template '_header'}

<div class="page-heading"> 
	<span class='pull-right'>
		{ifp 'shop.banner.add'}
			<a class="btn btn-primary btn-sm" href="{php echo webUrl('shop/banner/add')}">添加新广告</a>
		{/if}
		<a class="btn btn-default  btn-sm" href="{php echo webUrl('shop/banner')}">返回列表</a>  
	</span>
	<h2><i class="fa fa-circle-o"></i>{if !empty($item['id'])}编辑{else}添加{/if}广告 <small>{if !empty($item['id'])}修改【{$item['bannername']}】{/if}</small></h2> 
</div>

    <form {ife 'shop.banner' $item}action="" method="post"{/if} class="form-horizontal form-validate" enctype="multipart/form-data">
        <input type="hidden" name="id" value="{$item['id']}" />
 
                <div class="form-group">
                    <label class="col-sm-2 control-label">排序</label>
                    <div class="col-sm-9 col-xs-12">
                        {ife 'shop.banner' $item}
                        	<input type="text" name="displayorder" class="form-control" value="{$item['displayorder']}" />
                        	<span class='help-block'>数字越大，排名越靠前</span>
                        {else}
                            <div class='form-control-static'>{$item['displayorder']}</div>
                        {/if}
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label must">广告标题</label>
                    <div class="col-sm-9 col-xs-12 ">
                         {ife 'shop.banner' $item}
                        	<input type="text" id='bannername' name="bannername" class="form-control" value="{$item['bannername']}" data-rule-required="true" />
                         {else}
                        	<div class='form-control-static'>{$item['bannername']}</div>
                        {/if}
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">广告图片</label>
                    <div class="col-sm-9 col-xs-12">
                    	{ife 'shop.banner' $item}
	                        {php echo tpl_form_field_image('thumb', $item['thumb'])}
	                        <span class='help-block'>建议尺寸:640 * 350 , 请将所有广告图片尺寸保持一致</span>
                        {else}
                            {if !empty($item['thumb'])}
                            	<a href='{php echo tomedia($item['thumb'])}' target='_blank'>
                            		<img src="{php echo tomedia($item['thumb'])}" style='width:100px;border:1px solid #ccc;padding:1px' />
                            	</a>
                            {/if}
                        {/if}
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">广告链接</label>
                    <div class="col-sm-9 col-xs-12">
                    	{ife 'shop.banner' $item}
	                        <div class="input-group form-group" style="margin: 0;">
								<input type="text" value="{$item['link']}" class="form-control valid" name="link" placeholder="" id="bannerlink">
								<span data-input="#bannerlink" data-toggle="selectUrl" class="input-group-addon btn btn-default">选择链接</span>
							</div>
                        {else}
                        	<div class='form-control-static'>{$item['link']}</div>
                        {/if}
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">状态</label>
                    <div class="col-sm-9 col-xs-12">
                    	{ife 'shop.banner' $item}
	                        <label class='radio-inline'>
	                            <input type='radio' name='enabled' value=1' {if $item['enabled']==1}checked{/if} /> 显示
	                        </label>
	                        <label class='radio-inline'>
	                            <input type='radio' name='enabled' value=0' {if $item['enabled']==0}checked{/if} /> 隐藏
	                        </label>
	                    {else}
                            <div class='form-control-static'>{if empty($item['enabled'])}隐藏{else}显示{/if}</div>
                        {/if}
                    </div>
                </div>
            
            	<div class="form-group">
                    <label class="col-sm-2 control-label"></label>
                    <div class="col-sm-9 col-xs-12">
                           {ife 'shop.banner' $item}
                           		<input type="submit" value="提交" class="btn btn-primary"  />
                           {/if}
                       <input type="button" name="back" onclick='history.back()' {ifp 'shop.banner.add|shop.banner.edit'}style='margin-left:10px;'{/if} value="返回列表" class="btn btn-default" />
                    </div>
            	</div>
 
    </form>
{template '_footer'}